package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.StaticForMarketActivityEntity;
import com.xbongbong.saas.domain.entity.StaticForMarketUpdateEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author guohui.zhang
 * @Title:
 * @date 2020/12/1815:30
 */
@Repository
@Mapper
public interface StaticForMarketActivityDao {
    Integer insert(StaticForMarketActivityEntity paasFormData);

    Integer update(StaticForMarketActivityEntity paasFormData);

    Integer insertBatch(@Param("list") List<StaticForMarketActivityEntity> list);
    /**
     * 批量更新单个字段
     * @param list 更新的数据
     * @param corpid 公司id
     * @return Integer
     */
    void updateBatch(@Param("list") List<StaticForMarketUpdateEntity> list, @Param("corpid") String corpid);

    /**
     * 批量删除
     * @param list 删除的数据
     * @param corpid 公司id
     * @param del 删除标志
     * @return Integer
     */
    Integer deleteBatch(@Param("list") List<Long> list, @Param("corpid") String corpid, @Param("del") Integer del);
    
    Integer updateByMarketIdAndDel(@Param("corpid") String corpid, @Param("marketId") Long marketId, @Param("del") Integer del);
    //物理删除，别用
    Integer deleteByMarketId(@Param("corpid") String corpid, @Param("marketId") Long marketId);

    /**
     * 获取一条数据
     * @param marketId
     * @param corpid
     * @return
     */
    StaticForMarketActivityEntity getByMarketId(@Param("key") Long marketId, @Param("corpid") String corpid);
    StaticForMarketActivityEntity getByClueId(@Param("key") Long clueId,@Param("corpid") String corpid);
    StaticForMarketActivityEntity getByCustomerId(@Param("key") Long customerId, @Param("corpid") String corpid);
    StaticForMarketActivityEntity getBySaleId(@Param("key") Long saleId, @Param("corpid") String corpid);

    void updateBatchForStatic(@Param("list") List<StaticForMarketActivityEntity> updateEntitys);

    List<StaticForMarketActivityEntity> getEntitysForClueDeduplication(@Param("key") Long customerId, @Param("corpid")String corpid);

    List<StaticForMarketActivityEntity> getEntitysForCustomerDeduplication(@Param("key")  Long customerId, @Param("corpid") String corpid);

    List<StaticForMarketActivityEntity> findEntitys(@Param("param") Map<String, Object> param);

    List<StaticForMarketActivityEntity> getEntitysForOpportunityDeduplication(@Param("key")  Long opportunityId, @Param("corpid") String corpid);
}
